<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>创建日历</title>
  <link rel="stylesheet" href="/unpkg/lib-master/theme-chalk/index.css"> 
    <style type="text/css">
        html {
            min-width: 900px;
        }
        
        body {
            background: #f0f2f5;
            margin: 0;
            padding: 0;
        }
        [v-cloak] {
              display: none !important;
        }
        /*公共部分 start*/
        .public_header_container{
            height: 48px;
            background: #fff;
            display: -webkit-box;
            display: flex;
            -webkit-box-align: center;
            align-items: center;
            padding-left: 15px;
            border-bottom: 1px solid #e8e8e8;
        }
        .public_header_container p{
            font-size: 16px;
            font-weight: 500;
            color: rgba(0,0,0,.85);
            line-height: 28px;
        }
        .public_main_container{
            padding: 16px;
        }
        .public_main_content{
            background: #fff;
            padding: 24px;
        }
        .public_firstTitle_container{
            display: flex;
            align-items: center;
        }
        .public_firstTitle_container svg{
            cursor: pointer;
        }
        .customerInfo_firstTitle{
            /*font-weight: 700;*/
            font-size: 15px;
            margin-right: 6px;
            color: #333;
        }
        .line{
            width: 100%;
            height: 1px;
            background: #ececec;
            margin-top: 12px;
            margin-bottom: 16px;
        }
        /*公共部分 end*/
        .EditCalendarTitle_container{
            display: flex;
            align-items: center;
        }
        .EditCalendarTitle_container label{
            font-size: 14px;
            font-weight: 400;
            color: #000;
            line-height: 20px;
            word-break: keep-all;
            white-space: nowrap;
            position: relative;
        }
        .EditCalendarTitle_container input{
            height: 28px;
            padding: 4px 11px;
            color: rgba(0,0,0,.65);
            font-size: 14px;
            line-height: 28px;
            background-color: #fff;
            background-image: none;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            -webkit-transition: all .3s;
            transition: all .3s;
        }
        .EditCalendarTitle_container span{
            font-size: 14px;
            font-weight: 400;
            color: rgba(0,0,0,.65);
            line-height: 20px;
            margin-left: 10px;
            cursor: pointer;
        }
        .EditCalendarTitle_container span:last-child{
            color: #1890ff;
        }

        /*弹窗部分 选择群聊 star*/
        #app .el-dialog__body{
            padding-top: 10px;
        }
        .dialog_addGroup_container{

        }
        .dialog_addGroupSearch_container{
            
        }
        .dialog_addGroup_allGroup_container{
            margin-top: 8px;
            margin-bottom: 6px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .dialog_addGroup_allGroupLeft_container{
            
        }
        .dialog_addGroup_allGroupLeft_container span{
            font-size: 13px;
            color: #666;
        }
        .dialog_addGroup_allGroupRight_container{
            
        }
        .dialog_addGroup_groupList_container{
            height: 240px;
            overflow-x: hidden;
            overflow-y: auto;
        }
        .dialog_addGroup_groupList_container::-webkit-scrollbar{
          width:5px;
          height:10px;
          /**/
        }
        .dialog_addGroup_groupList_container::-webkit-scrollbar-track{
          background: rgb(239, 239, 239);
          border-radius:2px;
        }
        .dialog_addGroup_groupList_container::-webkit-scrollbar-thumb{
          background: #bfbfbf;
          border-radius:10px;
        }
        .dialog_addGroup_groupList_container::-webkit-scrollbar-thumb:hover{
          background: #333;
        }
        .dialog_addGroup_groupList_container::-webkit-scrollbar-corner{
          background: #179a16;
        }
        .dialog_addGroup_groupList_container li{
            display: flex;
            align-items: center;
            padding-top: 20px;
            padding-right: 10px;
        }
        .dialog_addGroup_groupList_container li:first-child{
            padding-top: 10px;
        }
        .dialog_addGroup_groupList_container li img{
            width: 40px;
            height: 40px;
            border-radius: 3px;
            margin-right: 11px;
        }
        .dialog_addGroup_groupList_content{
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .dialog_addGroup_groupListLeft_content{
            flex: 1;
        }
        .dialog_addGroup_groupListLeft_content h3{
            color: #222;
            font-size: 14px;
            font-weight: 500;
        }
        .dialog_addGroup_groupListLeft_content h4{
            font-size: 12px;
            color: #999;
            opacity: .85;
        }
        .dialog_addGroup_groupListRight_content{
            
        }
        .dialog_addGroup_groupListRight_content input{
            cursor: pointer;
        }
        .dialog_addGroup_groupListLeft_content p{
            
        }
        /*弹窗部分 选择群聊 end*/
        /*弹窗部分 添加推送内容 start*/
        .pushSOP_message_content{
            position: relative;
            padding-bottom: 6px;
        }
        .pushSOP_sendNav_container{
            position: relative;
            display: flex;
            align-items: center;
            margin-top: 10px;
        }
        .pushSOP_sendNav_container p{
            color: rgba(0,0,0,.65);
            font-size: 14px;
        }
        .pushSOP_sendNav_container input{

        }
        .pushSOP_sendNav_container .el-icon-delete{
            position: absolute;
            right:0;
            cursor: pointer;
        }
        .pushSOP_sendNavRadio{
            display: flex;
            align-items: center;
            margin-right: 8px;
        }
        .pushSOP_sendContent_content{
            margin-top: 10px;
            padding-left: 46px;
        }
        .punlic_sendContent_container1{
            padding: 10px 0;
            min-height: 112px;
            box-sizing: border-box;
            background: #fbfbfb;
            border: 1px solid #eee;
        }
        .pushSOP_sendContentText_container1{
            
        }
        .pushSOP_sendContentText_container1 textarea{
            width: 100%;
            height: 100%;
            border: none;
            resize: none;
            outline: none;
            font-size: 14px;
            font-weight: 400;
            color: rgba(0,0,0,.85);
            line-height: 20px;
            box-sizing: border-box;
            overflow: auto;
            background: #fbfbfb;
            font-family: microsoft yahei;
        }
        .pushSOP_sendContentImg_container1{
            display: flex;
            justify-content: space-between;
        }
        
        .pushSOP_sendContentLink_container1{
            padding: 12px;
            /*width: 505px;*/
            height: 50px;
            box-sizing: border-box;
            background: #fbfbfb;
            border: 1px solid #eee;
            display: -webkit-box;
            display: flex;
            -webkit-box-align: center;
            align-items: center;
            min-height:50px;
        }
        .pushSOP_sendContentLink_container1 input{
            border: none!important;
            background: #fbfbfb;
            outline: none;
            box-shadow: none;
            width: 100%;
            height: 32px;
            padding: 4px 11px;
            color: rgba(0,0,0,.65);
            font-size: 14px;
        }
        .pushSOP_sendContentSvg{
            position: absolute;
            right: 0;
            top: 3px;
            padding: 2px;
            cursor: pointer;
            background: #f0f0f0;
        }
        /*上传图片*/
        .avatar-uploader .el-upload {
            border: 1px dashed #d9d9d9;
            border-radius: 6px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
          }
          .avatar-uploader .el-upload:hover {
            border-color: #409EFF;
          }
          .avatar-uploader-icon {
            font-size: 28px;
            color: #8c939d;
            width: 178px;
            height: 178px;
            line-height: 178px;
            text-align: center;
          }
          .avatar {
            width: 178px;
            height: 178px;
            display: block;
          }
          .dialog_addPush_container{

          }
          .publishDialog_entry_container{
            margin-bottom: 15px;
          }
          .publishDialog_entryLabel{
            position: relative;
            font-size: 14px;
            font-weight: 600;
            color: rgba(0,0,0,.85);
            line-height: 22px;
            padding-left: 9px;
            position: relative;
            margin-bottom: 12px;
            display: block;
          }
          .publishDialog_entryLabel::before{
            position: absolute;
            content: "";
            display: block;
            width: 3px;
            height: 13px;
            background: #1890ff;
            left: 0;
            top: 45%;
            -webkit-transform: translateY(-50%);
            transform: translateY(-50%);
          }
          .publishDialog_entry_content{
            margin-bottom: 10px;
          }
          .publishDialog_entry_content b{
            font-size: 14px;
            font-weight: 400;
            color: rgba(0,0,0,.85);
            line-height: 18px;
            margin-left: 3px;
          }
          .publishDialog_SendMessage_container{
              
          }
          .dialog_addPushPublicLink_container{
            display: flex;
            align-items: center;
            margin-bottom: 12px;
          }
          .dialog_addPushPublicLink_container p{
            margin-left: 10px;
          }
          .dialog_addPushSeniorList_container li{
            display: flex;
            align-items: center;
            margin-bottom: 12px;
          }
          .addLabelButton{
            color: #1890ff;
            border-color: #1890ff;
            height: 28px;
            padding: 0 12px 0 9px;
            border-radius: 4px;
            background: #fff;
            border: 1px solid #1890ff;
            margin: 0 10px 0 0;
            float: left;
            cursor: pointer;
          }
          .dialog_addPushPublicCheckbox_container{
            display: flex;
            align-items: center;
            margin-bottom: 12px;
          }
          .dialog_addPushPublicCheckbox_container p{
            margin-left: 10px;
          }
          .dialog_addPushCustomerLabel_container{
            overflow: hidden;
          }
          .dialog_addPushCustomerLabelList_container{

          }
          .dialog_addPushCustomerLabelList_container li{
            height: 28px;
            background: #f7f7f7;
            border-radius: 4px;
            padding: 0 8px 0 10px;
            border: 1px solid #e9e9e9;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            margin-right: 10px;
            margin-bottom: 8px;
            float: left;
            display: flex;
            align-items: center;
          }
          .dialog_addPushCustomerLabelList_container li span{
            font-size: 14px;
            color: #606266;
          }
          .dialog_addPushCustomerLabelList_container li svg{
            width: 16px;
            height: 16px;
            margin-left: 5px;
            cursor: pointer;
          }
        /*弹窗部分 添加推送内容 end*/

        /*主要的头部部分*/
        .GroupCalendarDetails_MainHeader_container{
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        /*时间轴部分*/
        .GroupCalendarDetails_Main_container{

        }
        .GroupCalendarDetails_time_container{

        }
        .GroupCalendarDetails_timeToday_container{
            padding-top: 10px;
        }
        .GroupCalendarDetails_timeListNodata_container{
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding:100px 0;
        }
        .GroupCalendarDetails_timeListNodata_container img{
            width: 168px;
            height: 119px;
        }
        .GroupCalendarDetails_timeListNodata_container p{
            margin-top: 19px;
            text-align: center;
            font-size: 14px;
            font-weight: 400;
            color: rgba(0,0,0,.45);
            line-height: 22px;
        }
        .GroupCalendarDetails_timeList_container{

        }
        .GroupCalendarDetails_timeList_container li{

        }
        .GroupCalendarDetails_timeList_container li h4{
            font-size: 16px;
            font-weight: 500;
            color: rgba(0,0,0,.85);
            line-height: 22px;
            padding: 5px 0;
        }
        .GroupCalendarDetails_timeList_title_container{
            display: flex;
            align-items: center;
            padding-bottom: 3px;
        }
        .GroupCalendarDetails_timeList_title_container span{
            font-size: 12px;
            font-weight: 400;
            color: #7a828f;
            line-height: 17px;
            width: 47px;
            text-align: right;
            padding-right: 5px;
            box-sizing: border-box;
        }
        .GroupCalendarDetails_timeList_title_container svg{
            width: 20px;
            height: 20px;
        }
        .GroupCalendarDetails_timeList_title_container h3{
            font-size: 14px;
            color: rgba(0,0,0,.85);
            font-weight: 500;
            margin-left: 10px;
        }
        .creatSop_list_content{
            width: 659px;
            background: #fbfbfb;
            border: 1px solid #f2f2f2;
            position: relative;
            padding: 0 20px 8px 16px;
        }
        .creatSop_list_content ul li{

        }
        .creatSop_list_content ul li span{
            font-size: 14px;
            color: #333;
        }
        .creatSop_list_content ul li a{
            font-size: 14px;
            color: #1890ff;
        }
        .creatSop_list_content ul li img{
            width: 80px;
            height: 80px;
            display: block;
            margin-top: 12px;
        }
        .creatSop_list_bg{
            margin-top: 12px;
            background: #fff;
            box-shadow: 0 0 2px 0 rgba(0,0,0,.04);
            border-radius: 2px 16px 16px 24px;
            border: 1px solid #f6f6f6;
            padding: 10px 16px;
            word-break: break-all;
        }
        .creatSop_listAbsolute_container{
            position: absolute;
            bottom: -4px;
            right: -65px;
        }
        .creatSop_listAbsolute_container svg{
            margin: 0 2px;
            background: #f0f0f0;
            padding: 2px;
            cursor: pointer;
        }
        .GroupCalendarDetails_timeList_content{
            border-left: 1px dashed #d8dfe4;
            margin-left: 57px;
            padding: 10px 0 10px 21px;
        }
        .GroupCalendarDetails_timeList_link_container{
            display: flex;
            align-items: center;
        }
        .GroupCalendarDetails_timeList_link_container img{
            margin-right: 8px;
            margin-top: 0 !important;
        }
        .GroupCalendarDetails_timeList_link_content{
            flex: 1;
            display: flex;
            flex-direction: column;
            /*align-items: center;*/
        }
        .GroupCalendarDetails_timeList_link_content p{
            color: rgba(0,0,0,.65);
            font-size: 14px;
            line-height: 21px;
        }
        .calendar span{
            font-size: 12px;
            position: relative;
        }
        .is-today span.day{
            padding:3px 4px;
            background-color: #30A9FF;
            color: #ffffff;
            border-radius: 50%;
        }
        .el-calendar-table .el-calendar-day{
            height: 150px;
        }
        .calendar ul{
            list-style: none;
            -webkit-box-flex: 1;
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 0;
            margin-top: 5px;
        }
        .calendar ul li.disable {
            background: #f2f5f8;
            color: rgba(0,0,0,.65);
            display: flex;
            justify-content: space-between;
        }
        .calendar ul li.disable i{
            font-size: 16px;
        }
        .calendar ul li {
            padding: 3px 7px;
            background: #ddedff;
            margin-top: 4px;
            font-size: 12px;
            font-weight: 400;
            color: rgba(0,0,0,.8);
            line-height: 17px;
        }
        .dayEvent{
            display: block;
            width: 100%;
            height: 100%;
        }
        .avatar-uploader-icon{
            width: 96px;
            height: 96px;
            line-height: 96px;
        }
        .uploadImg{
            border: 1px dashed #e5e5e5;
            margin: 0 10px;
            cursor: pointer;
        }
    </style>

</head>

<body>
    <div id="app">
        <!-- 新版公共头部 -->
        <div class="public_header_container">
        	<p>创建日历</p>
        </div>
        <!-- 新公共内容区域 -->
        <div class="public_main_container">
            <div class="public_main_content">
                <el-row>
                    <div class="EditCalendarTitle_container">
                        <label>日历名称：</label>
                        <input type="text" v-model="CalendarTitle" placeholder="请填写日历名称">
                    </div>
                </el-row>
                <div class="line"></div>
                
                <!-- 主要的头部部分 -->
                <div class="GroupCalendarDetails_MainHeader_container">
                    <div class="GroupCalendarDetails_MainHeaderLeft_container">
                        <el-radio-group v-model="SwitchModel" size="medium">
                            <el-radio-button label="calendar">日历</el-radio-button>
                            <el-radio-button label="times">时间轴</el-radio-button>
                        </el-radio-group>
                    </div>
                </div>
                
                <!-- 主要部分 -->
                <div class="GroupCalendarDetails_Main_container">
                    <div class="GroupCalendarDetails_Calendar_container" v-if="SwitchModel == 'calendar'">
                        <el-calendar class="calendar">
                            <template slot="dateCell" slot-scope="{ date,data }">
                                <div class="dayEvent" @click="eventAction(data)">
                                    <span class="day">!{!{data.day.slice(8)}}</span>
                                    <ul class="col-td current" id="3-1">
                                        <li class="disable" v-for="(item,index) in formData" v-if="item.date == data.day">
                                            <span class="active">【!{!{ item.title }}】!{!{ item.time }}</span>
                                            <i class="el-icon-delete" @click.stop="deleteActive(index)"></i>
                                        </li>
                                    </ul>
                                </div>
                            </template>
                        </el-calendar>
                    </div>
                    
                    <!-- 时间轴 -->
                    <div class="GroupCalendarDetails_time_container" v-if="SwitchModel == 'times'">
                        <div class="GroupCalendarDetails_timeToday_container">
                            <el-button type="primary" size="medium" plain @click="eventAction">+ 添加</el-button>
                        </div>
                       <!-- 有数据 -->
                       <ul class="GroupCalendarDetails_timeList_container">
                           <li  v-for="(item,index) in formData">
                               <h4>!{!{item.date}}</h4>
                               <div class="GroupCalendarDetails_timeList_title_container">
                                   <span>!{!{item.time}}</span>
                                   <h3>!{!{item.title}}</h3>
                               </div>
                               <div class="GroupCalendarDetails_timeList_content">
                                   <div class="creatSop_list_content">
                                       <ul>
                                           <div v-for="tem in item.content">
                                               <li class="creatSop_list_bg" v-if="tem.type==0"><span>!{!{tem.text}}</span></li>
                                               <li v-if="tem.type==1"><img :src="tem.imgs"></li>
                                               <li class="creatSop_list_bg" v-if="tem.type==2">
                                                   <div class="GroupCalendarDetails_timeList_link_container">
                                                       <img :src="tem.link.imgs">
                                                       <div class="GroupCalendarDetails_timeList_link_content">
                                                           <p>!{!{tem.link.tit}}</p>
                                                           <p>!{!{tem.link.des}}</p>
                                                       </div>
                                                   </div>
                                               </li>
                                           </div>
                                       </ul>
                                       <div class="creatSop_listAbsolute_container">
                                           <div class="creatSop_listAbsolute_content">
                                               <i class="el-icon-delete" @click.stop="deleteActive(index)"></i>
                                           </div>
                                       </div>
                                   </div>
                               </div>
                           </li>
                       </ul>
                    </div>
                    <div class="GroupCalendarDetails_timeToday_container">
                        <el-button type="primary" size="medium" @click="addCalendar">创建</el-button>
                    </div>
                </div>
                
                <!-- 弹窗添加推送内容 start -->
                <el-dialog title="添加推送内容" :visible.sync="dialogAddPushVisible" width="776px" center v-cloak>
                  <div class="dialog_addPush_container">
                        <div class="publishDialog_entry_container">
                            <label class="publishDialog_entryLabel">设置内容名称：</label>
                            <div class="publishDialog_entry_content">
                                <el-input size="small" v-model="CalendarContent.title" placeholder="设置内容名称，仅内部可见" style="width: 400px;"></el-input>
                            </div>
                        </div>
                        <div class="publishDialog_entry_container">
                            <label class="publishDialog_entryLabel">设置发送时间：</label>
                            <div class="publishDialog_entry_content">
                                <el-date-picker 
                                    v-model="CalendarContent.date" 
                                    type="date" 
                                    value-format="yyyy-MM-dd" 
                                    placeholder="选择日期" 
                                    :picker-options="datePickerOptions">
                                </el-date-picker>
                                
                                <el-time-picker 
                                    v-model="CalendarContent.time" 
                                    value-format="HH:mm:ss" 
                                    placeholder="选择时间">
                                </el-time-picker>
                                <b>提醒群主发送</b>
                            </div>
                        </div>
                        <div class="publishDialog_entry_container">
                            <label class="publishDialog_entryLabel">设置发送内容：</label>
                            <div class="publishDialog_SendMessage_container" >
                                <div class="pushSOP_message_content" v-for="(item,index) in CalendarContent.content">
                                    <div class="pushSOP_sendNav_container">
                                        <p>消息!{!{index+1}}：</p>
                                        <div class="pushSOP_sendNavRadio">
                                            <el-radio v-model="item.type" :label="0">文字</el-radio>
                                            <el-radio v-model="item.type" :label="1">图片</el-radio>
                                            <el-radio v-model="item.type" :label="2">链接</el-radio>
                                        </div>
                                        <div class="del" @click="removeCalendarContent(index)"><i class="el-icon-delete"></i></div>
                                    </div>
                                    
                                    <div class="pushSOP_sendContent_content">
                                        <div class="pushSOP_sendContentText_container1 punlic_sendContent_container1" v-if="item.type==0">
                                            <el-input 
                                            v-model="item.text" 
                                            type="textarea" 
                                            rows="5"
                                            cols="100"
                                            placeholder="请输入内容"  
                                            maxlength="3000" 
                                            show-word-limit></el-input>
                                        </div>  
                                        <div class="pushSOP_sendContentImg_container1 punlic_sendContent_container1" v-if="item.type==1">
                                            <div class="uploadImg" @click="uploadImage(index)">
                                              <img v-if="item.imgs" :src="item.imgs" class="avatar">
                                              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                                            </div>
                                        </div>
                                        <div class="punlic_sendContent_container1" v-if="item.type==2">
                                            <ul class="dialog_addPushSeniorList_container">
                                            	<li>
                                            		<span class="dialog_addPushPublicLink_label">链接地址：</span>
                                            		<el-input style="width: 384px" placeholder="请输入链接地址" v-model="item.link.url" size="small"></el-input>
                                            	</li>
                                                <li>
                                            		<span class="dialog_addPushPublicLink_label">链接标题：</span>
                                            		<el-input style="width: 384px" placeholder="请输入链接标题" v-model="item.link.tit" size="small"></el-input>
                                            	</li>
                                            	<li>
                                            		<span class="dialog_addPushPublicLink_label">链接摘要：</span>
                                            		<el-input placeholder="请输入链接摘要" style="width: 384px" v-model="item.link.des" size="small"></el-input>
                                            	</li>
                                            	<li>
                                            		<span class="dialog_addPushPublicLink_label">链接图片：</span>
                                            		<div class="uploadImg" @click="uploadImage(index)">
                                            		  <img v-if="item.link.imgs" :src="item.link.imgs" class="avatar">
                                            		  <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                                            		</div>
                                            	</li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <el-row type="flex" class="row-bg" justify="space-between">
                            <el-row type="flex" style="padding-top: 8px;">
                              <el-button type="primary" plain size="small" @click="addCalendarContent">+ 添加发送内容</el-button>
                            </el-row>
                            <el-row justify="end" type="flex" style="padding-top: 8px;">
                              <el-button size="small" @click="dialogAddPushVisible = false">取消</el-button>
                              <el-button size="small" type="primary" @click="submitCalendarData">设置</el-button>
                            </el-row>
                        </el-row>
                    </div>
                </el-dialog>
                <!-- 弹窗添加推送内容 end -->
            </div>
        </div>
    </div>
    <script src="/fission/js/layui.all.js"></script>
    <script src="/unpkg/unpkg.vue.js"></script>
    <script src="/cdn/qs.min.js"></script>
    <script src="/unpkg/lib-master/index.js"></script>
    <script src="/unpkg/unpkg.axios.min.js"></script>
    <script type="text/javascript">
        var myapp = new Vue({
            el: '#app',
            data() {
                return {
                    CalendarTitle:null,
                    SwitchModel:'calendar',
                    dialogAddPushVisible: false,
                    formData:[],
                    CalendarContent:{
                        title: null,
                        date: null,
                        time: null,
                        content:[{
                            type: 0,
                            text: null, // 文字
                            imgs: null, // 图片
                            link:{ // 链接
                                url: null, // 链接地址
                                tit: null, // 链接标题
                                des: null ,// 链接描述
                                imgs: null // 链接图片
                            }
                        }]
                    },
                    datePickerOptions:{
                        disabledDate: time => {
                            return time.getTime() < Date.now() - 8.64e7;
                        }
                    }
                };
            },
            methods: {
                eventAction(data){
                    let lTime = new Date(data.day).getTime()
                    let nTime = (new Date(new Date().toLocaleDateString())).getTime()
                    if(lTime < nTime) return this.$message.warning('不可以选择今天之前的日期哦～')
                    let h = (new Date()).getHours().toString() < 10 ? '0'+ (new Date()).getHours().toString() : (new Date()).getHours().toString();
                    let m = (new Date()).getMinutes().toString() < 10 ? '0'+ (new Date()).getMinutes().toString() : (new Date()).getMinutes().toString();
                    let s = (new Date()).getSeconds().toString() < 10 ? '0'+ (new Date()).getSeconds().toString() : (new Date()).getSeconds().toString();
                    this.CalendarContent.date = data.day || new Date().toLocaleDateString().split('/').join('-')
                    this.CalendarContent.time = h + ':' + m + ':' + s
                    this.dialogAddPushVisible = true;
                },   
                deleteActive(index){
                    this.formData.splice(index,1)
                },
                addCalendarContent(){
                    this.CalendarContent.content.push({
                        type: 0,
                        text: null,
                        imgs: null,
                        link:{
                            url: null,
                            tit: null,
                            des: null,
                            imgs: null
                        }
                    });
                },
                removeCalendarContent(index){
                    this.CalendarContent.content.splice(index,1)
                },
                addCalendar(){
                    if(!this.CalendarTitle) return this.$message.error('日历名称不能为空')
                    let loading = this.$loading(!{text: '请稍等...'});
                    axios({
                        method:'POST',
                        url:'/Addons/Groupcalendar/Admin/Calendar/saveData.html',
                        data: { title: this.CalendarTitle,postdata:this.formData }
                    }).then( resp => {
                        loading.close();
                        if(resp.data.status!='success') return this.$message.error(resp.data.msg)
                        this.$message.success('添加成功')
                        window.location.href='list.html'
                    })
                },
                uploadImage(index){
                    let _this = this;
                    layer.open( { title:'图片库', type: 2, area: ['700px', '450px'], fixed: false, maxmin: false, content: '/imgLib/lib.html?type=vshop_img' } );
                    window.uploadImgCallback = (tgt,url) => {
                        if(_this.CalendarContent.content[index].type == 1){
                            _this.CalendarContent.content[index].imgs = url
                        }
                        if(_this.CalendarContent.content[index].type == 2){
                            _this.CalendarContent.content[index].link.imgs = url
                        }
                    };
                },
                submitCalendarData:function(e){
                    let error = null;
                    if(!this.CalendarContent.title) { return this.$message.error('内容名称不能为空'); }
                    this.CalendarContent.content.some( (it,index) =>{
                        if(it.type==0 && !it.text) { error = '消息'+ (index+1)+'的文字不能为空';return true;}
                        if(it.type==1 && !it.imgs) { error = '消息'+ (index+1)+'的图片不能为空';return true;}
                        if(it.type==2 && !it.link.url) { error = '消息'+ (index+1)+'的链接地址不能为空';return true;}
                        if(it.type==2 && !it.link.tit) { error = '消息'+ (index+1)+'的链接标题不能为空';return true;}
                        if(it.type==2 && !it.link.des) { error = '消息'+ (index+1)+'的链接描述不能为空';return true;}
                        if(it.type==2 && !it.link.imgs) { error = '消息'+ (index+1)+'的链接图片不能为空';return true;}
                    })
                    if(error) return this.$message.error(error);
                    this.dialogAddPushVisible = false;
                    this.formData.push(this.CalendarContent);
                    this.CalendarContent = {
                        title: null,
                        date: null,
                        time: null,
                        content:[{
                            type: 0,
                            text: null,
                            imgs: null,
                            link:{
                                url: null,
                                tit: null,
                                des: null,
                                imgs: null
                            }
                        }]
                    }
                }
            }
        })
    </script>
</body>

</html>